A total of 858 characters, expected to take 3 minutes to complete reading.
Configure IDEA
Quick installation of IDEA
The IDEA The official download address is here (click), here we recommend the free version now. IntelliJ IDEA Community.
There are many installation tutorials for IDEA online, and they are not introduced here.
Install Android plug-ins
Open first IDEA, just build a project, and then we click File-Settings-Plugins(I installed the Chinese-Chinese plug-in in advance here, and the English is File-Settings-Pluginsand then search Chinese You can install the Chinese plug-in!):
Search Android Plug-in and install. The installation here may be a bit slow or fail? If there is an agent, it can be found in Settings-Appearance or Behavior-System Settings-HTTP Proxy Inside the settings to speed up the subsequent download steps.
After installation, restart IDEA.
New Android Project
We click File-New-Project:
Select New Android Project, for convenience, we directly create a template Activity:
Here if you're not down Android SDK If so, it will automatically help you download and set up an open agent, otherwise.... Very slow.
After the new construction gradle It will take a while to automatically build, which may be slow:
At this time, the project cannot be run. Don't panic, just wait a little.
The main file IDEA of our project is automatically created, called MainActivity:
On the right, we are prompted to build the project. Just click Build again.
Run Project
Before running the code you write, you should first connect to the next virtual machine or your mobile phone. After all, the computer is not a mobile phone and cannot directly run your project.
We find the right side or the upper side Device Manager:
Click Add Device:
Here I'm under Android 13 of virtual machines:
After configuration, we click the run button on the upper side, IDEA will automatically help you start the virtual machine and install the program into it:
Let's just wait:
The code runs successfully!
Compile the APK file
Click on the upper left corner Build-Build APK:
We generate a self-signed APK file and don't use it on the APK Store:
Since we are generating the APK installation package for the first time, there is no certificate. Click New Certificate and follow the steps below:
Note: The password is created by yourself! Don't forget!
Select ReleaseThe next step is done!
Then wait for us to build the file in the lower right corner:
At this time in us Home Directory-app-release There will be one under the folder. apk The papers! Just throw it on your phone and install it!